<?php if (!defined('BASEPATH')) exit('No direct script access allowed'); 

// @TODO: Get results only where they are set to active

class Reg_model extends CI_Model
{
	protected $_table;	    
	/**
	 * Constructor
	 *
	 * @access	public
	 */
	function __construct()
	{
		parent::__construct();
		$this->load->helper('date');
	}
	
	function get_all_dangky($limit, $start)
	{
		//$this->db->select('product.id, product.product_name, product.app_id, product.file, product.price, product.category_id, product.status, category.id as categoryid, category.category_name');
		//$this->db->from('product','category');
		//$this->db->join('category', 'category.id = product.category_id');
		$this->db->select('*');
		$this->db->from('dangkyhoc');
		$this->db->order_by('id','desc');
		$this->db->limit($limit, $start);
		//$this->db->where('product.created_by', $userid);
		$query = $this->db->get();
		return $query->result_array();
	}	
	
	function get_tenlop()
	{
		$this->db->select('id, malop, tenlop');
		$this->db->from('lophoc');
		$query = $this->db->get();
		return $query->result();
	}
	
	function delete_dangky($id)
	{
		$this->db->where('id', $id);
		$this->db->delete('dangkyhoc');
	}

	public function count_all_dangky()
	{
		$this->db->select('id');
		$this->db->from('dangkyhoc');
		return $this->db->count_all_results();
	}
}

/* Location: ./application/models/reg_model.php */